#!/bin/sh

CUR_PATH=$(cd "$(dirname "$0")"; pwd)
source ${CUR_PATH}/mysql_server.conf
for script in `ls ${CUR_PATH}/common_table/*.sql`
do 
    mysql -h${HOSTNAME}  -P${PORT}  -u${USERNAME} -p${PASSWORD} -D${DBNAME} < "${script}"
done

date_array=('2020-01-01' '2021-01-01' '2022-01-01' '2023-01-01' '2024-01-01')
for script in `ls ${CUR_PATH}/partition_table/*.sh`
do
	for curr_date in ${date_array[@]}
		do
			#echo "$script $curr_date"
			. ${script} "${curr_date}"
		done

done
